﻿
package fflib.container 
{
	import flexunit.framework.Assert;
	import flexunit.framework.TestCase;
	
	public class SLinkedListTest extends TestCase
	{
		public function testFirst():void
		{
			var list:SLinkedList = new SLinkedList();
			
			Assert.assertEquals(null, list.first());
			
			list.add(123);
			
			Assert.assertEquals(123, list.first());
			
			list.push(321);
			
			Assert.assertEquals(321, list.first());
		}
		
		public function testLast():void
		{
			var list:SLinkedList = new SLinkedList();
			
			Assert.assertEquals(null, list.last());
			
			list.add(123);
			
			Assert.assertEquals(123, list.last());
			
			list.add(321);
			
			Assert.assertEquals(321, list.last());
		}
		
		public function testSize():void
		{
			var list:SLinkedList = new SLinkedList();
			
			Assert.assertEquals(0, list.size());
			
			list.add(123);
			
			Assert.assertEquals(1, list.size());
			
			list.add(321);
			
			Assert.assertEquals(2, list.size());
		}
		
		public function testContains():void
		{
			var list:SLinkedList = new SLinkedList();
			
			Assert.assertEquals(false, list.contains(123));
			
			list.add(123);
			
			Assert.assertEquals(true, list.contains(123));
		}
	}
}
